package Day3;

public class Company {
    String CompanyName;
    String address;
    String PhoneNumber;
    String Business;
    int count = 0;
    String[] names = new String[10];
    public void Show(){
        System.out.println(CompanyName+"公司是你不二的选择");
        System.out.println("注册地址："+address);
        System.out.println(CompanyName+"公司电话："+PhoneNumber);
        System.out.println(CompanyName+"公司经营范围："+Business);
    }

    public int add(String newName){
        for (int i = 0; i < names.length; i++) {
            if (names[i] == null) {
                names[i] = newName;
                count++;
                System.out.println("面试成功，明天来上班！");
                return count;
            }
        }
        System.out.println("加人失败，没有空位子了");
        return count;
    }
    public boolean Delete(String BadName){
        for (int i = 0; i < names.length-1 ; i++) {
            if (names[i].equals(BadName)){
                names[i] = names[i+1];
                names[names.length-1] = null;
                count--;
                return true;
            }

        }
        return false;
    }
    public void Info(){
        System.out.println("强盛集团员工信息如下：");
        for (int i = 0; i < names.length; i++) {
            if (names[0] == null){
                System.out.println("暂时没有消息");
                break;
            }
            if (names[i] == null){
                System.out.println("");
                break;
            }

            System.out.print(names[i] + " ");
        }
        System.out.println();
    }

}
